package com.rongmai.web.ctrl;

import com.rongmai.db.dto.NewsDTO;
import com.rongmai.db.model.BaseResult;
import com.rongmai.db.vo.Page;
import com.rongmai.web.bo.NewsBo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/news")
public class NewsCtrl {

    @Resource
    private NewsBo newsBo;

    @RequestMapping("list")
    public BaseResult<Page<NewsDTO>> list(@RequestBody NewsDTO newsDTO) {
        return BaseResult.succ(newsBo.page(newsDTO));
    }

    @RequestMapping("get")
    public BaseResult<NewsDTO> get(Long id) {
        return BaseResult.succ(newsBo.get(id));
    }


}
